package com.im;

import java.awt.Rectangle;
import java.util.ResourceBundle;

// 常量
class Const {
    // 图标
    public static final String ICON_FILE_PATH = "res/%02d.png";                                         // 文件路径
    public static final int ICON_COUNT = 24;                                                            // 数量

    // 数据长度
    public static final int MAX_USER_COUNT = 50;                                                        // 最大好友数
    public static final int MAX_USERNAME_LEN = 16;                                                      // 最大用户名长度
    public static final int MAX_PASSWORD_LEN = 16;                                                      // 最大密码长度
    public static final int MAX_CONTENT_LEN = 1023;                                                     // 一次发送的最大聊天内容长度

    // 主窗口
    public static final int WIDTH = 293;                                                                // 宽度
    public static final int HEIGHT = 527;                                                               // 高度
    public static final String BUTTON_LOGON_IMAGE_PATH = "./res/ButtonLogon.png";                       // "登录"按钮图片
    public static final String BUTTON_REG_IMAGE_PATH = "./res/buttonReg.png";                           // "注册"按钮图片
    public static final String BUTTON_ADD_FRIEND_IMAGE_PATH = "./res/buttonAddFriend.png";              // "添加好友"按钮图片
    public static final String BUTTON_MCHAT_IMAGE_PATH = "./res/buttonMchat.png";                       // "群发消息"按钮图片
    public static final String BUTTON_LOGOFF_IMAGE_PATH = "./res/buttonLogoff.png";                     // "离线"按钮图片

    // 登录窗口
    public static final int LOGON_WINDOW_WIDTH = 220;                                                   // 宽度
    public static final int LOGON_WINDOW_HEIGHT = 156;                                                  // 高度
    public static final int LOGON_WINDOW_EDIT_WIDTH = 100;                                              // 编辑框宽度
    public static final Rectangle LOGON_WINDOW_LABEL_USERNAME_BOUNDS = new Rectangle(14, 13, 40, 14);   // "用户名"标签位置和尺寸
    public static final Rectangle LOGON_WINDOW_EDIT_USERNAME_BOUNDS = new Rectangle(59, 13, 132, 22);   // "用户名"编辑框的位置和尺寸
    public static final Rectangle LOGON_WINDOW_LABEL_PASSOWRD_BOUNDS = new Rectangle(14, 42, 40, 14);   // "密码"标签位置和尺寸
    public static final Rectangle LOGON_WINDOW_EDIT_PASSWORD_BOUNDS = new Rectangle(59, 41, 132, 22);   // "密码"编辑框的位置和尺寸
    public static final Rectangle LOGON_WINDOW_BUTTON_OK_BOUNDS = new Rectangle(14, 76, 83, 28);        // "登录"按钮的位置和尺寸
    public static final Rectangle LOGON_WINDOW_BUTTON_CANCEL_BOUNDS = new Rectangle(107, 76, 83, 28);   // "注册"按钮的位置和尺寸

    // 注册窗口
    public static final int REG_WINDOW_WIDTH = 292;                                                     // 宽度
    public static final int REG_WINDOW_HEIGHT = 388;                                                    // 高度
    public static final int REG_WINDOW_EDIT_WIDTH = 100;                                                // 编辑框宽度
    public static final int REG_WINDOW_ICON_LIST_ROW_COUNT = 4;                                         // 图标列表行数
    public static final int REG_WINDOW_CTRL_INSET_H = 15;                                               // 控件的横向间距
    public static final int REG_WINDOW_CTRL_INSET_V = 5;                                                // 控件的纵向间距

    // 聊天窗口
    public static final int CHAT_WINDOW_WIDTH = 412;                                                    // 宽度
    public static final int CHAT_WINDOW_HEIGHT = 310;                                                   // 高度
    public static final int CHAT_WINDOW_EDIT_HISTORY_ROW = 10;                                          // 历史控件行数
    public static final int CHAT_WINDOW_EDIT_INPUT_ROW = 3;                                             // 编辑框行数
    public static final int CHAT_WINDOW_CTRL_INSET_H = 10;                                              // 控件的横向间距
    public static final int CHAT_WINDOW_CTRL_INSET_V = 5;                                               // 控件的纵向间距

    // 字符串
    private static final ResourceBundle RESOURCE = ResourceBundle.getBundle("language_zh_CN");          // 资源
    
    // 其它
    public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";                                // 时间格式，格式例：2015-01-01 14:00:00
    public static final String LEFT_BR = "  [";
    public static final String RIGHT_BR = "]\r\n";
    public static final String WRAP = "\r\n\r\n";

    /**
     * 获取字符串。
     * @param id   字符串 id
     * @return 字符串
     */
    public static String getString(String id) {
        return RESOURCE.getString(id);
    }
}
